<template>
  <div class="mend-list-container">
    <div class="searchBox">
      <Search
        :initData="initSearchData"
        @emitSearchData="getSearchData"
      ></Search>
    </div>

    <div class="tableBox">
      <CustomTable :searchData="searchData"></CustomTable>
    </div>
  </div>
</template>

<script>
import { initUserInfo } from "@/unit/tool";
import CustomTable from "./components/table";
import Search from "./components/search";

export default {
  name: "areaStatisticsDetail",
  components: {
    CustomTable,
    Search
  },
  data() {
    return {
      userName: "",
      name: "",
      role: "",
      compId: "",
      initSearchData: {},
      searchData: {}
    };
  },
  computed: {},
  methods: {
    getSearchData(value) {
      // this.$nextTick(() => {
      //   this.searchData = Object.assign(this.searchData, value);
      // });
      this.searchData = {
        ...value
      };
    }
  },
  created() {
    initUserInfo(this);
    let { timeType, ...rest } = this.$route.query;
    this.initSearchData = {
      timeType: parseInt(timeType),
      searchType: 0,
      ...rest
    };
    this.searchData = Object.assign(this.searchData, this.initSearchData);
  },
  mounted() {
    // let { timeType, ...rest } = this.$route.query;
    // this.initSearchData = {
    //   timeType: parseInt(timeType),
    //   ...rest
    // };
    // this.searchData = Object.assign(this.searchData, this.initSearchData);
    // this.searchData = {
    //   aa: 123
    // };
  }
};
</script>

<style scoped="scoped">
.searchBox {
  margin-bottom: 16px;
}

.tableBox {
  padding: 16px;
  background-color: #ffffff;
}
</style>
